package com.moyu.frame;

import com.moyu.activity.PanelGame;

import javax.swing.*;
import java.awt.*;

public class myFrameGame extends JFrame {
    public myFrameGame(Boolean musicon){
        int width = 920;
        int height = 724;
        //设置标题
        this.setTitle("Java俄罗斯方块");
        //窗口默认显示
        this.setVisible(true);
        //设置退出窗口即关闭程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置窗口宽高
        this.setSize(width,height);
        //设置窗口不可更改大小
        this.setResizable(false);
        // 得到显示器屏幕的宽、高
        int screenwidth = Toolkit.getDefaultToolkit().getScreenSize().width;
        int screenheight = Toolkit.getDefaultToolkit().getScreenSize().height;
        //窗体居中
        this.setBounds((screenwidth - width) / 2,(screenheight - height) / 2, width, height);
        //设置默认panel为游戏窗口
        PanelGame panelGame = new PanelGame(musicon);
        this.setContentPane(panelGame);
    }
}
